#pragma once

#include <AVUITriggerBase.h>
#include <AVUISetterBaseCollection.h>

namespace AVUI {

/// <summary>Represents a trigger that applies property values or performs actions when the bound data meets a specified condition.</summary>
class DataTrigger : public TriggerBase
{
public:
    DECLARE_ELEMENT(DataTrigger, TriggerBase);

#pragma region Public Methods

    /// <summary>Initializes a new instance of the <see cref="T:System.Windows.DataTrigger" /> class.</summary>
    DataTrigger() { }

#pragma endregion Public Methods

#pragma region Public Properties

    /// <summary>Gets or sets the binding that produces the property value of the data object.</summary>
    /// <returns>The default value is null.</returns>
    BindingBase* get_Binding() { VerifyAccess(); return m_pBinding; }
    void set_Binding(BindingBase* pValue);
    DECLARE_PROPERTY(Binding, BindingBase, false);

    /// <summary>Gets a collection of <see cref="T:System.Windows.Setter" /> objects, which describe the property values to apply when the data item meets the specified condition.</summary>
    /// <returns>The default value is null.</returns>
    SetterBaseCollection* get_Setters();
    DECLARE_READONLY_PROPERTY(Setters, SetterBaseCollection, true);

    /// <summary>Gets or sets the value to be compared with the property value of the data object.</summary>
    /// <returns>The default value is null. See also the Exceptions section.</returns>
    /// <exception cref="T:System.ArgumentException">Only load-time <see cref="T:System.Windows.Markup.MarkupExtension" />s are supported.</exception>
    /// <exception cref="T:System.ArgumentException">Expressions are not supported. Bindings are not supported.</exception>
    Object* get_Value() { VerifyAccess(); return m_pValue; }
    void set_Value(Object* pValue);
    DECLARE_PROPERTY_BEGIN(Value, Object, false)
        DECLARE_ATTRIBUTE_DEPENDSON(Binding)
    DECLARE_PROPERTY_END()

#pragma endregion Public Properties

public:

#pragma region Internal Methods

    virtual bool GetCurrentState(DependencyObject* pContainer, UncommonField<HybridDictionaryArray>* pDataField) AVUI_OVERRIDE;
    virtual void Seal() AVUI_OVERRIDE;

#pragma endregion Internal Methods

private:

#pragma region Private Fields

    TRefCountedPtr<BindingBase> m_pBinding;
    TRefCountedPtr<SetterBaseCollection> m_pSetters;
    TRefCountedPtr<Object> m_pValue;

#pragma endregion Private Fields

};

}; // namespace AVUI
